<?php
/**
 * theme : default
 * description : contact
 * author : Gmax
 */

//déclaration des variables pour l'affichage de la page
$posts = $this->getPublications();
$article = $posts[0];
$category = $this->getCategory();
if($this->getTarget()!==null && $this->getTarget()->haveMedia()){
    $topImage = $this->getTarget()->getMedia();
}elseif($category!==null && $category->haveMedia()){
    $topImage = $category->getMedia();
}

?>
<?php if(isset($topImage)&&$topImage!==null&&$topImage->getHeight()>0): ?>
<div class="top-image">
    <img class="banniere" src="<?php echo $topImage->getUrl(); ?>" width="<?php echo $topImage->getWidth(); ?>" alt="<?php echo $topImage->getLegende(); ?>" title="<?php echo $topImage->getTitle(); ?>"/>
</div>
<?php else: ?>
<div class="gabarit-top-image">
    &nbsp;
</div>
<?php endif; ?>
<!--div class="ligne-annonce container">
    <div class="columns five offset-by-eleven">
        <div class="encart-annonce bg_vert_75"><a href="javascript:openReservation();" class="blanc">Gagnez du temps<br/>Réservez en ligne !</a></div>
    </div>
</div-->
<div class="container hidden">
    <?php echo $this->getBreadcrumb('|'); ?>
</div>
<div class="separateur">&nbsp;</div>
<div id="content" class="container">
    <div class="columns five" itemscope itemtype="http://schema.org/WPSideBar">
        <div class="encart-sidebar bg_brun text-center">
            <?php
            $adresse = modele::findByPermalien('adresse', 'category');
            if($adresse!==null && $adresse->getNombrePublications(true)>0){
                $articleAdresse = $adresse->getPublications(0,1,true);
                echo $articleAdresse[0]->getContent();
            }
            ?>
            <p><img src="<?php echo $this->getBaseUrl().$this->getThemePath().'/gfx/arabesque.png'; ?>" title="séparateur de block" alt="séparateur"/></p>
            <?php
            $horaires = modele::findByPermalien('horaires', 'category');
            if($horaires!==null && $horaires->getNombrePublications(true)>0){
                $articleHoraires = $horaires->getPublications(0,1,true);
                echo $articleHoraires[0]->getContent();
            }
            ?>
        </div>
        <div class="separateur">&nbsp;</div>
        <div class="encart-sidebar bg_rose text-center">
            <?php echo $article->getSummary(); ?>
        </div>
    </div>
     <div class="columns eleven">
        <article><div class="article">
            <?php echo $article->getContent(); ?>
        </div></article>
    </div>
</div>
<?php $cadeau = modele::findByPermalien('idee-cadeau', 'category'); ?>
<?php if($cadeau !== null && $cadeau->getNombrePublications(true)>0): ?>
<div class="separateur">&nbsp;</div>
<div class="container">
    <div class="columns sixteen titre gris"><?php echo $cadeau->getTitle(); ?></div>
</div>
<div id="content" class="container">
    <?php
        $publications = $cadeau->getPublications(0,1,true);
        $publication = $publications[0];
    ?>
    <div class="columns six">
        <?php if($publication->haveMedia()): ?><img src="<?php echo $publication->getMedia()->getUrl(); ?>" width="100%" /><?php endif; ?>
    </div>
    <div class="columns ten">
        <article id="post_<?php echo $publication->getId(); ?>"><div class="article">
            <div class="post-content">
                <h2 class="vert"><?php echo $publication->getTitle(); ?></h2>
                <?php echo $publication->getContent(); ?>
            </div>
        </div></article>
    </div>
</div>
<?php endif; ?>
